// Copyright (c) 2025 Zhou Yiyan
// Dynamic World Generation Library is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

// Package worldgen provides core types and interfaces for dynamic world generation.
package worldgen

// ChunkCoord represents the unique coordinates of a map chunk.
type ChunkCoord struct {
	X, Y int
}

// TileType represents the type of a single tile on the map.
type TileType int

const (
	TileTypeEmpty TileType = iota
	TileTypeGrass
	TileTypeWater
	TileTypeForest
	TileTypeMountain
	TileTypeDesert
	TileTypeLava
)

// ChunkData represents the tile data for a single chunk.
type ChunkData [][]TileType

// Generator is the core interface for world generation algorithms.
type Generator interface {
	// GenerateChunk generates chunk data for the given coordinates.
	// neighbors provides adjacent chunk data for seamless transitions.
	GenerateChunk(coord ChunkCoord, difficulty, similarity float64,
		neighbors map[ChunkCoord]ChunkData) (ChunkData, error)
}

// NeighborProvider is a function type for querying neighboring chunk data.
// This allows the generator to remain decoupled from chunk storage.
type NeighborProvider func(coord ChunkCoord) (ChunkData, error)
